import config from '@/config/app.config';

export function start(admin) {
  const openTaishitu = () => {
    if (config.get('autoOpenStatEnabled')) {
      setTimeout(() => {
        openModuleByCode('taishitu', {
          onLoad: () => {}
        });
      }, 1000);
    }
  };

  const openDashboard = () => {
    this.pushPage({
      path: '/dashboard',
      autostart: true
    });
  };

  switch (admin.roleId) {
  case 1:
    openDashboard();
    openTaishitu();
    break;
  case 9:
    openDashboard();
    openTaishitu();
    break;
  case 10:
    openModuleByCode('ycyl.chat.doctorView');
    break;
  case 11:
    openDashboard();
    openTaishitu();
    break;
  case 13:
    this.pushPage('/callcenter/workbench');
    openTaishitu();
    break;
  case 14:
    openDashboard();
    openTaishitu();
    break;
  case 15:
    openDashboard();
    openTaishitu();
    break;
  case 2:
  case 3:
  case 4:
    this.pushPage('/shop/stat/trade');
    break;
  default: 
    openDashboard();
  }
}